<%@page import="Model.Banner.Logo"%>
<%@page import="RssEasy.Core.CookieHelper"%>
<%@page import="Model.Purchase.ProjectClassList"%>
<%@page import="Model.Friend.FriendList"%>
<%@page import="Model.Supplier.SupplierExcellentView"%>
<%@page import="Model.Supplier.SupplierList"%>
<%@page import="Model.Purchase.PurchaseMaterielListView"%>
<%@page import="Model.Purchase.PurchaseListView"%>
<%@page import="java.util.Calendar"%>
<%@page import="RssEasy.Core.DateTimeExtend"%>
<%@page import="Model.Purchase.PurchaseList"%>
<%@page import="Model.Banner.BannerList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>企企通-首页</title>
        <meta name="description" content="这里写网站内容描述" />
        <meta name="keywords" content="这里写关键词" />
        <meta name="Robots" contect="all">
        <link href="/css/reset.css" rel="stylesheet" type="text/css"/>
        <link href="/inc/head.css" rel="stylesheet" type="text/css"/>
        <link href="/inc/footer.css" rel="stylesheet" type="text/css"/>
        <link href="/css/index.css" rel="stylesheet" type="text/css"/>
    </head>
    <body id="home">
        <%@include file="/inc/head.jsp" %>
        <!--广告区域-->
        <div id="gbbg">
            <div id="advert">
                <div id="play">
                    <ul>
                        <%
                            BannerList banner = new BannerList(pageContext);
                            banner.pagesize = 3;
                            banner.select("link,id,imgPath,types").where("types=1").get_page_desc("id");
                            while (banner.for_in_rows()) {%>
                        <li><a href="<%=banner.get("link")%>" target="_blank"><img src="/upfile/<%=banner.get("imgPath")%>" alt=""/></a></li>
                                <% } %>
                    </ul>
                    <button id="left">&lt;</button>
                    <button id="right">&gt;</button>
                    <ol>
                        <li class="sl"></li>
                        <li></li>
                        <li></li>
                    </ol>
                </div>
                <div id="exhibit">
                    <div id="number">
                        <em>今日项目数量</em>
                        <a id="login" href="/login/login.jsp">登录</a> 
                        <%
                            PurchaseList pu = new PurchaseList(pageContext);
                            long shijian = DateTimeExtend.timestamp() - 7 * 86400;
                            long enddt = DateTimeExtend.timestamp() - 30 * 86400;
                            pu.keyvalue("state", "3");
                            pu.update().where("enddt > " + enddt + " and enddt < " + shijian + " and typid=1 and state=1").submit();
                            PurchaseList pl = new PurchaseList(pageContext);
                            pl.keyvalue("state", "2");
                            pl.update().where("enddt > " + enddt + " and enddt < " + shijian + " and typid=2 and state=1").submit();
                            PurchaseList project = new PurchaseList(pageContext);
                            long y = DateTimeExtend.timestamp() - Calendar.HOUR_OF_DAY * 60 * 60;
                            project.select("count(id) as total").where("shijian>" + y + "").get_first_rows();
                        %>
                        <b><% project.write("total");%></b>
                        <a id="register" href="/login/register">免费注册</a>
                        <span>目前累计数量</span>
                        <% project.select("count(id) as total").get_first_rows(); %>
                        <strong><% project.write("total");%></strong>
                        <div  id="personal">
                            <a href="/my/">
                                <img src="img/home.png"/>
                                <p></p>
                            </a>
                        </div>
                    </div>
                    <div id="publish">
                        <a href="/source/create" target="_blank">发布寻源内容</a><a href="/purchase/create" target="_blank">发布询比价</a>
                    </div>
                    <div id="newPublish">
                        <h3>最新发布</h3>
                        <ul>
                            <%
                                project.pagesize = 5;
                                project.select("typid,id,name,shijian,state").where("state=1").get_page_desc("id");
                                while (project.for_in_rows()) {
                            %>
                            <li><em projectType="<%project.write("typid");%>"></em><a href="/purchase/details/<%=project.get("id")%>" target="_blank"><%project.write("name");%></a><i rssdate="<% project.write("shijian");%>,yyyy-MM-dd"></i></li>
                                    <% }%>
                        </ul>
                    </div>
                </div>
                <div id="logoLogos">
                    <%
                        Logo logo = new Logo(pageContext);
                        logo.pagesize = 12;
                        logo.select().get_page_desc("id");
                        while (logo.for_in_rows()) {
                    %>
                    <a href="<%=logo.get("links")%>" target="_blank"><img src="/upfile/<%=logo.get("logos")%>" alt="logo"/></a>
                        <% }%> 
                </div>
            </div>
        </div>
        <img src="img/gg.jpg" />
        <!--采购项目-->
        <div id="purchase">
            <div id="list">
                <h2>采购项目</h2>
                <div>
                    <form action="/purchase_list" method="post">
                        项目类别：
                        <select  name="purchase_class">
                            <option value="">请选择</option>
                            <option value="6">材料</option>
                            <option value="7">设备</option>
                            <option value="8">劳务</option>
                        </select><button>查询</button>
                    </form>
                    <a href="/purchase/list">查看更多&gt;&gt;</a>
                </div>
                <table cellspacing="0">
                    <thead>
                        <tr>
                            <td>项目名称</td>
                            <td class="two">采购物</td>
                            <td>截止时间</td>
                            <td>操作</td>
                        </tr>
                    </thead>
                    <tbody>
                        <%
                            PurchaseMaterielListView pmv = new PurchaseMaterielListView(pageContext);
                            PurchaseMaterielListView nu = new PurchaseMaterielListView(pageContext);
                            nu.select("count(*) as num").where("typid=1 and state=1 or state=2").get_first_rows();
                            String offer="";
                            String href ="";
                            String href1 ="";
                            String target ="";
                            pmv.select("typid,state,projectid,name,materielname,enddt").where("typid=1 and state=1 or state=2").get_page_desc("projectid");
                            while (pmv.for_in_rows()) {
                                if(pmv.get("state").equals("2")){
                                    offer ="已截止";
                                    href="javascript:void(0);";
                                    target ="";
                                    href1="/purchase/result/"+pmv.get("projectid")+"";
                                    
                                }else{
                                    offer ="立即报价";
                                    href="/purchase/details/"+pmv.get("projectid")+"";
                                    target ="_blank";
                                    href1="/purchase/details/"+pmv.get("projectid")+"";
                                }
                        %>
                        <tr>
                            <td><a href=<%=href1%> target="_blank"><%=pmv.get("name")%></a></td>
                            <td><%=pmv.get("materielname")%></td>
                            <td endtime="<%=pmv.get("enddt")%>" id="<%=pmv.get("projectid")%>"></td>
                            <td><a href="<%=href%>" target="<%=target%>"><%=offer%></a></td>
                        </tr>
                        <% }%>
                    </tbody>
                </table>
                <input id="numb" type="hidden" value="<%nu.write("num");%>"/>
                <div id="switch">
                    <span>——换一批——</span>
                </div>
            </div>
            <div id="newProject">
                <h3>新发采购项目</h3>
                <ul>
                    <%
                        PurchaseList newProject = new PurchaseList(pageContext);
                        newProject.select("id,typid,state,name,shijian").where("typid=1 and state=1").get_page_desc("id");
                        while (newProject.for_in_rows()) {
                    %>
                    <li><em>&nbsp;</em><a href="/purchase/details/<%=newProject.get("id")%>" title="" target="_blank"><%=newProject.get("name")%></a><i rssdate="<%=newProject.get("shijian")%>,yyyy-MM-dd"></i></li>
                            <% }%>
                </ul>
                <img src="img/newPurchase.jpg"/>
            </div>
            <img src="img/fill.jpg" />
        </div>
        <!--供应商展示-->
        <div id="showcase">
            <div id="query">
                优秀供应商展示
                <form action="/search_qiye" method="post">
                    <input type="hidden" name="type" value="2"/>
                    <input type="text" name="keywords" placeholder="请输入供应商名称"/><button>查询</button>
                </form>
                <em>供应商查询：</em>
            </div>
            <div id="several">
                <%
                    SupplierExcellentView suv = new SupplierExcellentView(pageContext);
                    suv.pagesize =4;
                    int i=0;
                    suv.select("id,logo,corpname,honesty,yong,mainproducts,fulladress,myid,mainbusiness").get_page_desc("rank");
                    while (suv.for_in_rows()) {
                        i++;
                        Integer num = Integer.parseInt(suv.get("honesty"));
                %>
                <div class="details">
                    <div>
                        <a href="/supplier/home/<%=suv.get("myid")%>" target="_blank"><img src="/upfile/<%=suv.get("logo")%>" alt="企业logo"/> 
                            <%=suv.get("corpname")%>
                            <p>
                                诚信等级
                                <span>
                                    <% for (int n = 0; n < num; n++) { %>
                                    <img src="/img/huangguan.png"/>
                                    <% }%>
                                </span>
                            </p>
                        </a>
                    </div>
                    <ul>
                        <li>注册资金：<span><%=suv.get("yong")%>万</span></li>
                        <li>所属地区：<span><%suv.write("fulladress");%></span></li>
                        <li>主营品类：<span><%=suv.get("mainbusiness")%></span></li>
                    </ul>
                    <div class="cover<%=i%> lid">
                        <img src="/upfile/<%=suv.get("logo")%>" alt="<%suv.write("corpname");%>"/>
                        <p><%=suv.get("corpname")%></p>
                        <p>主营品类:<%=suv.get("mainbusiness")%></p>
                    </div>
                </div>
                <% }%>
            </div>
            <div id="excellent">
                <h3>优秀供应商排行</h3>
                <ul>
                    <%
                        SupplierExcellentView su = new SupplierExcellentView(pageContext);
                        su.pagesize =10;
                        int w = 0;
                        su.select("id,corpname,rank,myid").get_page_desc("rank");
                        while (su.for_in_rows()) {
                            w++;
                    %>
                    <li><i><% out.print(w);%></i><a href="/supplier/home/<%=su.get("myid")%>" target="_blank"><%=su.get("corpname")%></a></li>
                            <% }%>
                </ul>
            </div>
        </div>
        <!--友情链接-->
        <div id="links">
            友情链接：
            <div>
                <%
                    FriendList links = new FriendList(pageContext);
                    links.select().query();
                    while (links.for_in_rows()) {%>
                <a href="<%=links.get("site")%>" target="_blank"><%=links.get("net")%></a>
                <%}%>
            </div>
        </div>
        <div id="sele" str="">
            <div id="sele_pop">
                <p>如需更多服务请联系企企通</p>
                <div>
                    <span id="confirm" val="">确认</span>
                </div>
            </div>
        </div>
        <%@include file="/inc/footer.jsp"%>
        <%@include file="/inc/js_all.html"%>
        <script src="js/arealist.js" type="text/javascript"></script>
        <script src="data/dictdata.js" type="text/javascript"></script>
        <script src="js/rsseasy.map.js" type="text/javascript"></script>
        <script src="/data/channel.js" type="text/javascript"></script>
        <script src="js/index.js" type="text/javascript"></script>
    </body>
</html>








